//
//  RecommandViewController.m
//  Travel
//
//  Created by lanou on 15/9/18.
//  Copyright (c) 2015年 TeamThree. All rights reserved.
//

#import "RecommandViewController.h"
#import "RecommendScrollView.h"
#import "WonderfulStroyCollectionViewCell.h"
#import "RecommendCollectionReusableView.h"
#import "SpecialTopicCollectionViewCell.h"



@interface RecommandViewController ()<UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>
// 创建collectionView
@property (nonatomic, retain) UICollectionView *collectionView;

// 设置轮播图
@property (nonatomic, retain) RecommendScrollView *scrollView;

// 存放轮播图
@property (nonatomic, retain) NSMutableArray *imageArr;

@end

@implementation RecommandViewController

- (void)dealloc {
    
    [_collectionView release];
//    [_scrollView release];
    [_imageArr release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //[self setUpRecommandView];
    
}
//#pragma mark --------------- 懒加载 ----------------
//- (NSMutableArray *)imageArr {
//    if (!_imageArr) {
//        self.imageArr = [NSMutableArray array];
//    }
//    return _imageArr;
//}
//
//#pragma mark --------------- 设置推荐页面 ----------------
//
//- (void)setUpRecommandView {
//    
//    // 设置轮播图
////    NSMutableArray *imageArr = [NSMutableArray arrayWithObjects:@"努力.jpg", @"坚持.jpg", @"小老鼠.jpg", @"方向.jpg", @"风景.jpg", nil];
////    _scrollView = [[RecommendScrollView alloc] initWithFrame:(CGRectMake(0, 64, kWidth, kHeight / (667.0 / 200))) imageArr:imageArr delegate:self action:@selector(actionTapImage) timer:3.5 selector:@selector(cirulrly)];
////    [self.view addSubview:_scrollView];
//    
//    // 设置collectionView
//    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
//    _collectionView = [[UICollectionView alloc] initWithFrame:kBounds collectionViewLayout:layout];
//    _collectionView.backgroundColor = [UIColor colorWithRed:0.969 green:0.949 blue:0.902 alpha:1.000];
//    _collectionView.delegate = self;
//    _collectionView.dataSource = self;
//    [self.view addSubview:_collectionView];
//    [_collectionView registerClass:[WonderfulStroyCollectionViewCell class] forCellWithReuseIdentifier:@"WonderfulCell"];
//    [_collectionView registerClass:[RecommendCollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"recommend"];
//    [_collectionView registerClass:[SpecialTopicCollectionViewCell class] forCellWithReuseIdentifier:@"SpecialTop"];
//    [_collectionView registerClass:[ScrollCollectionViewCell class] forCellWithReuseIdentifier:@"ScrollCell"];
//    [layout release];
//}
//
//
//
//
//#pragma mark --------------- 轮播图的点击事件 ----------------
//
//- (void)actionTapImage {
//    
////    NSInteger index = _scrollView.contentOffset.x / kWidth;
////    index -= 1;
////    if (index == 5) {
////        index = 0;
////    }
//}
//
//
//#pragma mark --------------- 定时器添加事件 ----------------
//
//- (void)cirulrly:(UIScrollView *)scrollView {
//    
////    [self setUpScrollViewWithCirulrly:scrollView];
////    
////    CGPoint newPoint = scrollView.contentOffset;
////    newPoint.x += kWidth;
////    [scrollView setContentOffset:newPoint animated:YES];
//    
//}
//
//// 设置轮播图效果
//- (void)setUpScrollViewWithCirulrly:(UIScrollView *)scrollView {
////    if (scrollView.contentOffset.x == kWidth * 6) {
////        [scrollView setContentOffset:(CGPointMake(kWidth, 0)) animated:NO];
////    } else if (scrollView.contentOffset.x == 0) {
////        [scrollView setContentOffset:(CGPointMake(kWidth * 5, 0)) animated:YES];
////    }
//}
//
//- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
////    [self setUpScrollViewWithCirulrly:scrollView];
//}
//
//#pragma mark --------------- collectionView代理 ----------------
//
//// 返回分区数
//-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
//    return 3;
//}
//// 返回分区的行数
//- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
//    if (section == 1) {
//        return 4;
//    } else if (section == 2){
//        return 5;
//    } else {
//        return 1;
//    }
//}
//// 设置collectionView的cell
//- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
//    
//    if (indexPath.section == 1) {
//        WonderfulStroyCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"WonderfulCell" forIndexPath:indexPath];
////
////        return cell;
////    } else if (indexPath.section == 2) {
////        SpecialTopicCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"SpecialTop" forIndexPath:indexPath];
////
////        return cell;
////    } else {
////        ScrollCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ScrollCell" forIndexPath:indexPath];
////        // 设置轮播图
////        NSMutableArray *imageArr = [NSMutableArray arrayWithObjects:@"努力.jpg", @"坚持.jpg", @"小老鼠.jpg", @"方向.jpg", @"风景.jpg", nil];
////        [cell setScrollViewWithImageArr:imageArr delegate:self action:@selector(actionTapImage) timer:3.5 selector:@selector(cirulrly:)];
////        return cell;
////    }
////}
//// 设置增广视图
//- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
//    RecommendCollectionReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"recommend" forIndexPath:indexPath];
//    
//    if (indexPath.section == 1) {
//        reusableView.titleLabel.text = @"每日精选故事";
//        reusableView.moreLabel.text = @"全部";
//    } else if (indexPath.section == 2){
//        reusableView.titleLabel.text = @"精彩游记和专题";
//        reusableView.moreLabel.text = @" ";
//    }
//    
//    return reusableView;
//    
//}
////设置行间距
//- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
//    if (section == 0) {
//        return 0;
//    } else if (section == 2){
//        return 10;
//    } else {
//        return 13;
//    }
//}
//
//// 设置每个item的大小
//- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
//    if (indexPath.section == 1) {
//        return CGSizeMake((kWidth - 30) / 2, kHeight / (677.0 / 220));
//    } else if (indexPath.section == 2){
//        return CGSizeMake(kWidth - 20, kHeight / (677.0 / 210));
//    } else {
//        return CGSizeMake(kWidth, kHeight / (677.0 / 200));
//    }
//}
//
//// 设置距上 下 左 右的间隔
//- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
//    if (section == 0) {
//        return UIEdgeInsetsMake(0, 0, 0, 0);
//    } else {
//        return UIEdgeInsetsMake(0, 10, 0, 10);
//    }
//}
//// 设置表头的size
//- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
//    if (section == 0) {
//        return CGSizeMake(0, 0);
//    } else {
//        return CGSizeMake(kWidth, 55);
//    }
//}
//
//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
